// function User (name) {
//   this.name = name
// }
// User.prototype.sayHello = function () {
//   console.log(`hello ${this.name}`)
// }
// new User('xm').sayHello()


class User {
  constructor(name) {
    this.name = name
  }
  sayHello () {
    console.log(`hello ${this.name}`)
  }
}

class Employee extends User {
  constructor(name) {
    // 调用父类
    super(name)
  }
  hello(){
    // 调用父类方法
    super.sayHello()
    console.log(`输出完毕，name is ${this.name}`)
  }
}
const employee =  new Employee('小明')
employee.hello()